#ifdef U8glib 
#include "U8glib.h"
#include "Bitmap.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0 | U8G_I2C_OPT_NO_ACK | U8G_I2C_OPT_FAST); //实例化OLED

void initu8glibcode()
{
  u8g.setFont(u8g_font_9x18);
  dis_init();
}
void change_font_pos(void) {
  static  uint8_t dir = 0;
  static  unsigned long next = 0;

  if ( next < millis() )
  {
    switch(dir) {
      case 0: u8g.setFontPosBottom(); break;
      case 1: u8g.setFontPosBaseline(); break;
      case 2: u8g.setFontPosCenter(); break;
      case 3: u8g.setFontPosTop(); break;
    }
    
    dir++;
    dir &= 3;
    next = millis();
    next += 1000;
  }
}

 void u8g_bk_line(uint8_t a,uint8_t b,uint8_t c,uint8_t d) {
  u8g.drawStr( 0, 0, "drawLine");
  u8g.drawLine(a, b, c, b);
  u8g.drawLine(c, b, c, d);
  u8g.drawLine(c, d, a, d);
  u8g.drawLine(a, d, a, b);
}
void draw(void) {
  u8g_bk_line(0,0,127,63);
  u8g_bk_line(0,0,127,31);
  
  u8g.drawStr( 1, 2, "ch0=");
  delay(100);
  u8g.drawStr( 1, 30, "ch1=");

 // u8g.setFont(u8g_font_unifont);
 // u8g.setPrintPos(0, 20); 
 // u8g.print("Hello World!");
}

void dis_init()
{
  u8g.firstPage();
  do {
    u8g.drawBitmapP( 19, 0, 12, 64, woodbox);
  } while ( u8g.nextPage() );
}

void dis_falldown()
{
  u8g.drawBitmapP( 32, 0, 9, 64, fall_down);
}

void dis_happy()
{
  u8g.drawBitmapP( 32, 0, 8, 64, happy);
}

void dis_yun()
{
  u8g.drawBitmapP( 27, 0, 10, 64, yun);
}
void dis_yihuo()
{
  u8g.drawBitmapP( 34, 0, 8, 64, yihuo);
}
void dis_buman()
{
  u8g.drawBitmapP( 12, 0, 13, 64, buman);
}
void dis_huaji()
{
  u8g.drawBitmapP( 32, 0, 8, 64, huaji);
}
void dis_weixiao()
{
  u8g.drawBitmapP( 32, 0, 9, 64, weixiao);
}
void dis_die()
{
  u8g.drawBitmapP( 29, 0, 9, 64, die);
}
void dis_shengqi()
{
  u8g.drawBitmapP( 27, 0, 10, 63, shengqi);
}
void dis_shangxin()
{
  u8g.drawBitmapP( 20, 0, 10, 63, shangxin);
}
void dis_piezui()
{
  u8g.drawBitmapP( 17, 0, 12, 64, piezui);
}
void dis_deyi()
{
  u8g.drawBitmapP( 34, 0, 8, 63, deyi);
}
void dis_xiao()
{
  u8g.drawBitmapP( 32, 0, 9, 63, xiao);
}
void dis_jusang()
{
  u8g.drawBitmapP( 22, 0, 11, 63, jusang);
}
void dis_niupi()
{
  u8g.drawBitmapP( 32, 0, 8, 64, niupi);
}
#endif
